//
//  NSNotificationCenter+DogLegs.m
//  DogeLegs
//
//  Created by 宋华 on 2017/8/16.
//  Copyright © 2017年 宋华. All rights reserved.
//

#import "NSNotificationCenter+DogLegs.h"

@implementation NSNotificationCenter (DogLegs)
+ (void)removeAllNotification:(id)target
{
    [[NSNotificationCenter defaultCenter] removeObserver:target];
}


//COMMAND连接状态变化通知
+ (void)addCmdConnStatusChangeNotification:(id)target action:(SEL)action
{
    [[NSNotificationCenter defaultCenter] addObserver:target
                                             selector:action
                                                 name:CmdConnStatusChangeNotification
                                               object:nil];
}

+ (void)postCmdConnStatusChangeNotification:(NSDictionary *)userInfo
{
    [[NSNotificationCenter defaultCenter] postNotificationName:CmdConnStatusChangeNotification object:nil userInfo:userInfo];
}

+ (void)removeCmdConnStatusChangeNotification:(id)target
{
    [[NSNotificationCenter defaultCenter] removeObserver:target name:CmdConnStatusChangeNotification object:nil];
}

+ (void)addGetUserConfigDoneNotification:(id)target action:(SEL)action {
    [[NSNotificationCenter defaultCenter] addObserver:target
                                             selector:action
                                                 name:GetUserConfigDoneNotification
                                               object:nil];
}

+ (void)postGetUserConfigDoneNotification:(NSDictionary *)userInfo {
    [[NSNotificationCenter defaultCenter] postNotificationName:GetUserConfigDoneNotification object:nil userInfo:userInfo];

}

+ (void)removeGetUserConfigDoneNotification:(id)target {
  [[NSNotificationCenter defaultCenter] removeObserver:target name:GetUserConfigDoneNotification object:nil];
}

#pragma mark ------登录状态通知--------

// 登录状态切换通知
+ (void)addSwitchLoginStatusNF:(id)target action:(SEL)action
{
    [[NSNotificationCenter defaultCenter] addObserver:target
                                             selector:action
                                                 name:SwitchLoginStatusNotification
                                               object:nil];
}

+ (void)postSwitchLoginStatusNotification:(NSDictionary *)userInfo
{
    [[NSNotificationCenter defaultCenter] postNotificationName:SwitchLoginStatusNotification object:nil userInfo:userInfo];
}

+ (void)removeSwitchLoginStatusNotification:(id)target
{
    [[NSNotificationCenter defaultCenter] removeObserver:target name:SwitchLoginStatusNotification object:nil];
}

// 退出状态通知
+ (void)addSwitchLogoutStatusNF:(id)target action:(SEL)action
{
    [[NSNotificationCenter defaultCenter] addObserver:target
                                             selector:action
                                                 name:SwitchLogoutStatusNotification
                                               object:nil];
}

+ (void)postSwitchLogoutStatusNotification:(NSDictionary *)userInfo
{
    [[NSNotificationCenter defaultCenter] postNotificationName:SwitchLogoutStatusNotification object:nil userInfo:userInfo];
}

+ (void)removeSwitchLogoutStatusNotification:(id)target
{
    [[NSNotificationCenter defaultCenter] removeObserver:target name:SwitchLogoutStatusNotification object:nil];
}

//创建密码和验证成功
+ (void)addCreatePwNF:(id)target action:(SEL)action {
    
    [[NSNotificationCenter defaultCenter] addObserver:target
                                             selector:action
                                                 name:CreatePassWordNotification
                                               object:nil];
}

+ (void)postCreatePwNF:(NSDictionary *)userInfo {
    [[NSNotificationCenter defaultCenter] postNotificationName:CreatePassWordNotification object:nil userInfo:userInfo];
}

+ (void)removeCreatePwNF:(id)target {
    [[NSNotificationCenter defaultCenter] removeObserver:target name:CreatePassWordNotification object:nil];
}

//获取地址成功
+ (void)addUserAddressNF:(id)target action:(SEL)action {
    [[NSNotificationCenter defaultCenter] addObserver:target
                                             selector:action
                                                 name:GetUserAddressNotification
                                               object:nil];
}

+ (void)postUserAddressNF:(NSDictionary *)userInfo {
    [[NSNotificationCenter defaultCenter] postNotificationName:GetUserAddressNotification object:nil userInfo:userInfo];

}

+ (void)removeUserAddressNF:(id)target {
    [[NSNotificationCenter defaultCenter] removeObserver:target name:GetUserAddressNotification object:nil];
}


#pragma mark        ------- 消息模块通知--------
// 消息列表消息通知

+ (void)addMessageListMsgNF:(id)target action:(SEL)action
{
    [[NSNotificationCenter defaultCenter] addObserver:target
                                             selector:action
                                                 name:MessageListMsgNotification
                                               object:nil];
}

+ (void)postMessageListMsgNotification:(NSDictionary *)userInfo
{
    [[NSNotificationCenter defaultCenter] postNotificationName:MessageListMsgNotification object:nil userInfo:userInfo];
}

+ (void)removeMessageListMsgNotification:(id)target
{
    [[NSNotificationCenter defaultCenter] removeObserver:target name:MessageListMsgNotification object:nil];
}
// 消息聊天界面更新通知
+ (void)addMessageChatMsgNF:(id)target action:(SEL)action
{
    [[NSNotificationCenter defaultCenter] addObserver:target
                                             selector:action
                                                 name:MessageChatMsgNotification
                                               object:nil];
}
+ (void)postMessageChatMsgNotification:(NSDictionary *)userInfo
{
    [[NSNotificationCenter defaultCenter] postNotificationName:MessageChatMsgNotification object:nil userInfo:userInfo];
}
+ (void)removeMessageChatMsgNotification:(id)target
{
    [[NSNotificationCenter defaultCenter] removeObserver:target name:MessageChatMsgNotification object:nil];
}

#pragma mark - 语音模块
+ (void)addAudioRecorderDidFinishNotification:(id)target action:(SEL)action
{
    [[NSNotificationCenter defaultCenter] addObserver:target
                                             selector:action
                                                 name:AudioRecorderDidFinishNotification
                                               object:nil];
}
+ (void)postAudioRecorderDidFinishNotification:(NSDictionary *)userInfo
{
    [[NSNotificationCenter defaultCenter] postNotificationName:AudioRecorderDidFinishNotification object:nil userInfo:userInfo];
}
+ (void)removeAudioRecorderDidFinishNotification:(id)target
{
    [[NSNotificationCenter defaultCenter] removeObserver:target name:AudioRecorderDidFinishNotification object:nil];
}

+ (void)addAudioPlayDidFinishNotification:(id)target action:(SEL)action
{
    [[NSNotificationCenter defaultCenter] addObserver:target
                                             selector:action
                                                 name:AudioPlayDidFinishNotification
                                               object:nil];
}
+ (void)postAudioPlayDidFinishNotification
{
    [[NSNotificationCenter defaultCenter] postNotificationName:AudioPlayDidFinishNotification object:nil userInfo:nil];
}
+ (void)removeAudioPlayDidFinishNotification:(id)target
{
    [[NSNotificationCenter defaultCenter] removeObserver:target name:AudioPlayDidFinishNotification object:nil];
}


+ (void)addMICVolumeChangeNotification:(id)target action:(SEL)action
{
    [[NSNotificationCenter defaultCenter] addObserver:target
                                             selector:action
                                                 name:MICVolumeChangeNotification
                                               object:nil];
}
+ (void)postMICVolumeChangeNotification:(NSDictionary *)userInfo
{
    [[NSNotificationCenter defaultCenter] postNotificationName:MICVolumeChangeNotification object:nil userInfo:userInfo];
}
+ (void)removeMICVolumeChangeNotification:(id)target
{
    [[NSNotificationCenter defaultCenter] removeObserver:target name:MICVolumeChangeNotification object:nil];
}

+ (void)addOneVoiceCellPlayerNotification:(id)target action:(SEL)action {
    [[NSNotificationCenter defaultCenter] addObserver:target
                                             selector:action
                                                 name:OneVoiceCellPlayerNotification
                                               object:nil];
}
+ (void)postOneVoiceCellPlayerNotification:(NSDictionary *)userInfo {
    [[NSNotificationCenter defaultCenter] postNotificationName:OneVoiceCellPlayerNotification object:nil userInfo:userInfo];
}
+ (void)removeOneVoiceCellPlayerNotification:(id)target {
  [[NSNotificationCenter defaultCenter] removeObserver:target name:OneVoiceCellPlayerNotification object:nil];
}

@end
